package main

import (
	"net/http"
	"fmt"
	"strings"
	"log"
)

func main() {
	http.HandleFunc("/", sayHi)
	err := http.ListenAndServe(":9090",nil)
	if err != nil {
		log.Fatal("listenAndServer", err)
	}
}

func sayHi(writer http.ResponseWriter, request *http.Request)  {
	request.ParseForm()
	fmt.Println("request.Form=", request.Form)
	fmt.Println("request.URL.Path=", request.URL.Path)
	fmt.Println("request.URL.Scheme=", request.URL.Scheme)
	fmt.Println("request.Form[url_long]=", request.Form["url_long"])

	for k,v := range request.Form{
		fmt.Printf("key: %s, value: %s\n", k, strings.Join(v, ""))
	}
	fmt.Println(writer, "This is a go HTTP.")
}